]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
slider: Always use physical direction on smooth scroll
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 9 Aug 2025 07:43:11 +0000 (09:43 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 11 Aug 2025 08:34:22 +0000 (10:34 +0200)
Let the slider use the physical scroll direction, unaffected
by "natural scroll" settings. These widgets are not a "view"
where this setting does make sense, but rather the expectation
is that it's directly manipulable.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1012
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=703046
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3831>

js/ui/slider.js

index 6b09b4c40381bcfd79edfafe2f8f3303fef762ef..29c17500e9469bba3e6121203ca872eb0d3c3b2c 100644 (file)
@@ -161,10 +161,11 @@ export const Slider = GObject.registerClass({
         } else if (direction === Clutter.ScrollDirection.UP) {
             delta = SLIDER_SCROLL_STEP;
         } else if (direction === Clutter.ScrollDirection.SMOOTH) {
-            let [, dy] = event.get_scroll_delta();
-            // Even though the slider is horizontal, use dy to match
-            // the UP/DOWN above.
-            delta = -dy * SLIDER_SCROLL_STEP;
+            let [dx] = event.get_scroll_delta();
+            delta = dx * SLIDER_SCROLL_STEP;
+            // Match physical direction
+            if (event.get_scroll_flags() & Clutter.ScrollFlags.INVERTED)
+                delta *= -1;
         }
 
         this.value = Math.min(Math.max(0, this._value + delta), this._maxValue);